package com.lianxian.xindong.commonres.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.hxb.library.base.BaseFragment;

import java.util.ArrayList;

/**
 * @Author :hexingbo
 * @Date :2019/11/16
 * @FileName： MyPagerAdapter
 * @Describe :
 */
public class MyPagerTitleAdapter extends FragmentPagerAdapter {

    public String[] mTitles;
    public ArrayList<Fragment> mFragments;

    public MyPagerTitleAdapter(FragmentManager fm, String[] mTitles, ArrayList<Fragment> mFragments) {
        super(fm);
        this.mTitles = mTitles;
        this.mFragments = mFragments;
    }

    public MyPagerTitleAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }
}
